{extend name="admin@public/base" /}
{block name="styles"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/jQuery-Validation-Engine-2.6.2-ciaoca/css/validationEngine.jquery.css">
<script type="text/javascript" src="__PUBLIC__/jQuery-Validation-Engine-2.6.2-ciaoca/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="__PUBLIC__/jQuery-Validation-Engine-2.6.2-ciaoca/js/jquery.validationEngine.min.js"></script>
{/block}
{block name="main-content"}
<div class="page-content">
    <div class="row maintop">
        <div style="margin:10px 0;" id="rule-add">
            <form class="form-horizontal ajaxForm" name="admin_rule_add" method="post" action="{:url('admin/Sys/admin_rule_runadd')}">
                <div class="col-xs-12 col-sm-12">
                    <small>检测：</small>
                    <small>
                        <select name="notcheck">
                            <option value="0">检测</option>
                            <option value="1">不检测</option>
                        </select>
                    </small>
                    <small>状态：</small>
                    <small>
                        <select name="status">
                            <option value="1">显示</option>
                            <option value="0">不显示</option>
                        </select>
                    </small>
                    <small class="sl-left10">父级：</small>
                    <small>
                        <select name="pid" required>
                            <option value="0">--默认顶级--</option>
                            {foreach name="admin_rule_all" item="v"}
                            <option value="{$v.id}" style="margin-left:55px;">{$v.lefthtml}{$v.title}</option>
                            {/foreach}
                        </select>
                    </small>
                    <small class="sl-left10">名称：</small>
                    <small><input name="title" id="title" class="rule validate[required]"  placeholder=" 输入名称"/></small>
                    <small class="sl-left10">控/方：</small>
                    <small><input name="name" id="name" class="rule validate[required]"  placeholder=" 输入控制器/方法"/></small>
                    <small class="sl-left10">css：</small>
                    <small><input name="css" id="css" class="wh50"  placeholder=" css样式" /></small>
                    <small class="sl-left10">排序：</small>
                    <small><input name="sort" id="sort" class="wh30" value="50"/></small>
                    <small>
                        <button class="btn btn-xs btn-danger ruleadd">
                            添加权限
                        </button>
                    </small>
                </div>
            </form>
        </div>
        <div class="col-xs-12 col-sm-12 rule-top alert alert-info top10">
            <button type="button" class="close" data-dismiss="alert">
                <i class="ace-icon fa fa-times"></i>
            </button>
            1、《控/方》：意思是 控制器/方法; 例如 Sys/sys_list<br />
            2、菜单name检测规则：一级菜单=>控制器名，二级菜单=>不限制，但建议控制器/方法(选择默认的方法)，三级、四级菜单=>控制器/方法<br />
            3、css为控制左侧导航顶级栏目前图标样式(仅一级菜单有效)，具体可查看FontAwesome图标CSS样式
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div>
                    <form class="ajaxForm" name="ruleorder" method="post" action="{:url('admin/Sys/admin_rule_order')}" >
                        <table class="table table-striped table-bordered table-hover" id="dynamic-table">
                            <thead>
                                <tr>
                                    <th class="center">ID</th>
                                    <th class="center"></th>
                                    <th class="hidden-xs center">权限名称</th>
                                    <th class="center">控制器/方法</th>
                                    <th class="center">不检测</th>
                                    <th class="center">显示</th>
                                    <th class="hidden-sm hidden-xs center">级别</th>
                                    <th class="hidden-sm hidden-xs center">添加时间</th>
                                    <th class="hidden-sm hidden-xs center">排序</th>
                                    <th class="center" style="border-right:#CCC solid 1px;">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {foreach name="admin_rule" item="v"}
                                <tr id="{$pid}-{$v.id}">
                                    <td height="28" class="center">{$v.id}</td>
                                    <td><a data-id="{$v.id}" data-level="{$v.level}" href="{:url('admin/Sys/admin_rule_list')}" style="cursor:pointer;" class="rule-list"><span class="fa fa-plus blue"></span></a></td>
                                    <td class="hidden-xs" style='padding-left:{if condition="$v.leftpin neq 0"}{$v.leftpin}px{/if}' >{$v.lefthtml}{$v.title}</td>
                                    <td class="center">{$v.name}</td>
                                    <td class="center">
                                        {if condition="$v['notcheck'] eq 1"}
                                        <a class="red notcheck-btn" href="{:url('admin/Sys/admin_rule_notcheck')}" data-id="{$v.id}" title="不检测">
                                            <div id="zt{$v.id}"><button class="btn btn-minier btn-danger">不检测</button></div>
                                        </a>
                                        {else/}
                                        <a class="red notcheck-btn" href="{:url('admin/Sys/admin_rule_notcheck')}" data-id="{$v.id}" title="检测">
                                            <div id="zt{$v.id}"><button class="btn btn-minier btn-yellow">检测</button></div>
                                        </a>
                                        {/if}
                                    </td>
                                    <td class="center">
                                        {if condition="$v['status'] eq 1"}
                                        <a class="red display-btn" href="{:url('admin/Sys/admin_rule_state')}" data-id="{$v.id}" title="已显示">
                                            <div id="zt{$v.id}"><button class="btn btn-minier btn-yellow">显示</button></div>
                                        </a>
                                        {else/}
                                        <a class="red display-btn" href="{:url('admin/Sys/admin_rule_state')}" data-id="{$v.id}" title="已隐藏">
                                            <div id="zt{$v.id}"><button class="btn btn-minier btn-danger">隐藏</button></div>
                                        </a>
                                        {/if}
                                    </td>
                                    <td class="hidden-sm hidden-xs center">{$v.level}级</td>
                                    <td class="hidden-sm hidden-xs center">{$v.addtime|date='Y-m-d',###}</td>
                                    <td class="hidden-sm hidden-xs center"><input name="{$v.id}" value="{$v.sort}" class="list_order center"/></td>
                                    <td>
                                        <div class="hidden-sm hidden-xs center action-buttons">
                                            <a class="blue" href="{:url('admin/Sys/admin_rule_add',array('pid'=>$v['id']))}"  title="添加子类">
                                                <i class="ace-icon fa fa-plus-circle bigger-110"></i> 添加子类
                                            </a>
                                            <a class="green" href="{:url('admin/Sys/admin_rule_edit',array('id'=>$v['id']))}" title="编辑">
                                                <i class="ace-icon fa fa-pencil-square-o bigger-110"></i> 编辑
                                            </a>
                                            <a class="purple" href="{:url('admin/Sys/admin_rule_copy',array('id'=>$v['id']))}" title="复制">
                                                <i class="ace-icon fa fa-copy bigger-110"></i> 复制
                                            </a>
                                            <a class="red confirm-rst-url-btn" href="{:url('admin/Sys/admin_rule_del',array('id'=>$v['id']))}" data-info="你确定要删除吗？" title="删除">
                                                <i class="ace-icon fa fa-trash-o bigger-110"></i> 删除
                                            </a>
                                        </div>
                                        <div class="hidden-md hidden-lg center">
                                            <div class="inline position-relative">
                                                <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto">
                                                    <i class="ace-icon fa fa-cog icon-only bigger-110"></i>
                                                </button>
                                                <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
                                                    <li>	
                                                        <a href="{:url('admin/Sys/admin_rule_add',array('pid'=>$v['id']))}"  class="tooltip-success" data-rel="tooltip" title="" data-original-title="添加子类">
                                                            <span class="green">
                                                                <i class="ace-icon fa fa-plus-circle bigger-110"></i>
                                                            </span>
                                                        </a>						
                                                    </li>
                                                    <li>
                                                        <a href="{:url('admin/Sys/admin_rule_edit',array('id'=>$v['id']))}" class="tooltip-success" data-rel="tooltip" title="" data-original-title="编辑">
                                                            <span class="green">
                                                                <i class="ace-icon fa fa-pencil-square-o bigger-110"></i>
                                                            </span>
                                                        </a>
                                                    </li>
                                                    <li>
                                                        <a href="{:url('admin/Sys/admin_rule_copy',array('id'=>$v['id']))}" class="tooltip-success" data-rel="tooltip" title="" data-original-title="复制">
                                                            <span class="purple">
                                                                <i class="ace-icon fa fa-copy bigger-110"></i>
                                                            </span>
                                                        </a>
                                                    </li>
                                                    <li>
                                                        <a href="{:url('admin/Sys/admin_rule_del',array('id'=>$v['id']))}"  data-info="你确定要删除吗？" class="tooltip-error confirm-rst-url-btn" data-rel="tooltip" title="" data-original-title="删除">
                                                            <span class="red">
                                                                <i class="ace-icon fa fa-trash-o bigger-110"></i>
                                                            </span>
                                                        </a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                {/foreach}
                                <tr>
                                    <td colspan="10" align="left"><button type="submit"  id="btnorder" class="btn btn-white btn-yellow btn-sm">排序</button></td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div><!-- /.page-content -->
{/block}
{block name="scripts"}
<script type="text/javascript">
    $('.form-horizontal').validationEngine('attach',{
        promptPosition: 'bottomLeft',
        addPromptClass: 'formError-white',
        showOneMessage: true
    });
</script>
{/block}